package com.mike;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.function.Consumer;

public class ReadFile {

	public static void readLines(String file, Consumer<String> lineReader){
		readLines(new File(file), lineReader);
	}
	
	public static void readLines(File file, Consumer<String> lineReader){
		BufferedReader reader = null;
		try {
			reader = new BufferedReader(new FileReader(file));
			String line = null;
			while((line = reader.readLine()) != null)
				lineReader.accept(line);
		} catch (Exception e){
		} finally {
			if(reader != null)
				try { reader.close(); } catch (Exception e2){}
		}
	}
	
}
